package gdr.dev;

public class Util {
	
	/**
	 * Numero casuale from <= x < to
	 * @param from
	 * @param to
	 * @return
	 */
	public static int random(int from, int to){
		return from + (int)(Math.random() * (to - from));
	}
	/**
	 * Numero casuale 0 <= x <= to
	 * @param to
	 * @return
	 */
	public static int random(int to){
		return random(0, to);
	}
	/**
	 * Numero casuale from <= x <= to
	 * @param from
	 * @param to
	 * @return
	 */
	public static double random(double from, double to){
		return from + Math.random() * (to - from);
	}

	/**
	 * Numero casuale 0 <= x <= to
	 * @param to
	 * @return
	 */
	public static double random(double to){
		return random(0, to);
	}
}
